<div class="loading-container"><div class="loader"></div></div>

<div class="wrapper wrapper-shadow wrapper-list"> 
	<!-- list data wrapper -->
	<div class="result-wrapper no-padding">
   	<div class="result-body">
   		<div class="tabs">
      	<ul class="nav nav-tabs widget no-margin-bottom">
        	<li class="active"> 
         		<a href="#tab-content" data-toggle="tab"> 
         			<span class="menu-icon"><i class="fa fa-user-plus"></i></span> 文章信息
           	</a>
         	</li> 
        </ul>
        <div class="tab-content no-border xs-padding">
					<div class="tab-pane active" id="tab-content">
           	<div id="toolbar" class="btn-group">
					    <button type="button" class="btn btn-success" onclick="handlerCreate(this);"  data-editor-path="/miwawa/content/system/content/article/editor/" data-editor-page="add.html">
			        	<i class="glyphicon glyphicon-random"></i> 新增
					    </button>
						</div>
           	<table data-ajax="handlerSearch" 
       					 	 data-method="post" 
       					 	 data-search="true" 
       					 	 data-toolbar="#toolbar" 
       					 	 data-id-field="id" 
       					 	 data-unique-id="id" 
       					 	 data-pagination="true" 
       					 	 data-show-toggle="true" 
       					 	 data-show-refresh="true" 
       					 	 data-show-columns="true" 
       					 	 data-check-on-init="true" 
       					 	 data-click-to-select="true" 
       					 	 data-side-pagination="server" 
       					 	 data-mobile-responsive="true" 
       					 	 data-event-onload="handlerSuccess" 
       					 	 data-form-search="#search-form-article" id="table-article" class="bootstrap-table">
							<thead>
								<tr>
									<th data-checkbox="true"></th>
									<th data-field="id" 				 data-visible="false" data-switchable="false">ID</th>
									<th data-field="articleType" data-align="center" >类型</th>
									<th data-field="title" 			 data-halign="center" >标题</th>
									<th data-field="createTime"  data-align="center" >发布时间</th>
									<th data-field="shopName" 	 data-align="center" >发布机构</th>
									<th data-field="teacherName" data-align="center" >发布人</th>
									<th data-field="operator" 	 data-align="center" data-width="65" data-formatter="renderOperator" data-table-target="article">操作</th>
								</tr>
							</thead>
						</table>
        	</div>
      	</div>
    	</div>
   	</div>
	</div>

	<!-- form editor wrapper -->
	<div class="editor-wrapper">
		
	</div>
</div>
<!-- PAGE CONTENT END =============================================== -->

<!-- PAGE MODAL START =============================================== -->

<!-- PAGE MODAL END ================================================= -->

<!-- 查询表单 ========================================================= -->
<form id="search-form-article" action="/miwawa/default/common/search.json" method="post" 
			name="com.app.miwawa.api.system.entity.view.ArticleView">
			<input type="hidden" name="status" id="status" value="0" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="invalid" id="invalid" value="F" data-search-group="and" data-search-operation="EQ">
			<input type="hidden" name="shopId" id="shopId"  data-search-group="and" data-search-operation="EQ">
			<input type="hidden" data-search-sort="createTime" data-search-order="desc">
</form>

<!-- 删除表单 ========================================================= -->
<form id="remove-form-article" action="/miwawa/default/common/remove" method="post" name="com.app.miwawa.api.system.entity.Article"></form>
			
<!-- Javascript ===================================================== -->
<script src="/miwawa/resources/lib/miwawa/1.0.2/js/core/requirejs/require.js"></script>

<script type="text/javascript">
<!--
	
	jQuery(function(){
		jQuery(":hidden[name='centerid']",'#search-form-article').val(centerid);		
		require(['/miwawa/resources/lib/miwawa/1.0.2/js/core/module/app/simple.js'], function(simple){
			simple(['registerForm','registerTable','registerWidget']);
		});
		getShopId();		
	});
	
	function getShopId(){
		jQuery.ajaxsend({
      url:"/miwawa/default/common/search.json",
      async:false,
      data:{
          "entityClass" : "com.app.miwawa.api.system.entity.view.ShopView",
          "and[0][operator]": "EQ",
          "and[0][fieldName]": "invalid",					// 删除标识
          "and[0][fieldValue]": "F",						// F=有效的<未删除>、T=无效的<已删除>
          "and[1][operator]": "EQ",
          "and[1][fieldName]": "status",					// 状态标识
          "and[1][fieldValue]": "0",						// 默认为0
          "and[2][operator]": "EQ",
          "and[2][fieldName]": "dbname",				// 早教中心数据源
          "and[2][fieldValue]": dbname	        // dbname
      },
      success:function(data) {
        var dataList = data.rows;
        if(dataList.length != 0) {
        		$("#shopId").val(dataList[0].id);
        }
      }
	  });
	}
	
	function renderOperator(value, row, index){
				return "<a class='btn btn-info 	 btn-xs btn-table-op' onclick='handlerCreate(this, \""+row.id+"\")' data-table-source='#table-article' data-editor-path='/miwawa/content/system/content/article/editor' data-editor-page='edit.html' data-toggle='tooltip' data-placement='top' title='查看与编辑'> <i class='ion-compose'></i> </a>"
							+"<a class='btn btn-danger btn-xs btn-table-op' onclick='handlerRemove(this, \""+row.id+"\")' data-table-source='#table-article' data-form-source='#remove-form-article' data-toggle='tooltip' data-placement='top' title='删除'> <i class='fa fa-trash'></i> </a>";
	}
	
	// 打开模态窗口
	function handlerModal(trigger, url, before, callback){
		jQuery("#extension-modal").removeClass("modal-middle").data("url",url).data("onshow",function(){
			if(before) window[before](trigger);
		}).data("onhidden",function(){
			if(callback) window[callback](trigger);
		}).modal("show");
	}
	

//-->
</script>
